﻿package frEngine.shader.md5shader
{
    import baseEngine.core.*;
    import flash.display3D.*;
    import flash.events.*;
    import frEngine.core.*;
    import frEngine.shader.filters.fragmentFilters.*;
    import frEngine.shader.filters.vertexFilters.*;
    import frEngine.shader.registType.*;

    public class EdgeSahder extends Md5ShaderBase
    {
        private var _edgeColorRg:FcParam;
        private var _edgeTextureRg:FsParam;

        public function EdgeSahder(param1:int, param2:VertexFilter, param3:FragmentFilter)
        {
            super(param1, param2, param3);
            this.initEgedMaterialParams(param1);
            return;
        }// end function

        private function initEgedMaterialParams(param1:int) : void
        {
            this.materialParams.addFilte(new VertexNormalFilter());
            this.materialParams.addFilte(new Md5EdgeFilter());
            this.materialParams.setBlendMode(EBlendType.BLEND_ALPHA3);
            this.materialParams.depthCompare = Context3DCompareMode.LESS_EQUAL;
            return;
        }// end function

        override protected function materialRebuilder(event:Event) : void
        {
            super.materialRebuilder(event);
            this._edgeColorRg = getParam("{edgeColor}", false);
            this._edgeTextureRg = getParam("{texture1}", false);
            return;
        }// end function

        public function changeParams(param1:Number, param2:Number, param3:Number, param4:Texture3D) : void
        {
            if (this._edgeColorRg)
            {
                this._edgeColorRg.changeValue3(param1, param2, param3);
                this._edgeTextureRg.value = param4;
            }
            return;
        }// end function

    }
}
